<?php
/**
 * Created by PhpStorm.
 * User: Guangpeng Chen
 * Date: 15-9-15
 * Time: 下午4:15
 */
$data = file_get_contents('php://input');
$arr = json_decode($data);
//print_r($arr->land);
foreach ($arr->land as $k=>$v) {
//    echo $v->id,'----', $v->topic,PHP_EOL;
    $topics[$v->topic][] = $v->id;
//    print_r($v);
//    echo $k,'----',$v,PHP_EOL;
}
foreach ($topics as $topic=>$id_list)
{
    $sql = "update uu_land set topic='$topic' WHERE id IN(".implode(',', $id_list).") limit " . count($id_list).';' ;
    echo $sql,PHP_EOL;
}
//print_r($topics);